<script src="/javascripts/validation/jquery.validate.js" type="text/javascript"></script>
<script src="/javascripts/validation/validate_form.js" type="text/javascript"></script>

<span style="display:none;">
  <%= flash[:notice] %>
</span>

<div class="form login_reg">
  <% unless @user.id %>
    <h1>注册新用户</h1>
  <%else%>
    <h1>修改用户资料</h1>
  <%end%>
  <p class="tips">
    带<span style="color:red;">*</span>号为必填
  </p>
  <% form_for @user,:html=>{:id=>"user_form"} do |f| -%>
    <% unless @user.id %>
      <p><label for="user_login">账号</label>
        <%= f.text_field :login,:title=>"3-20位,字母数字组合.",:size=>15 %>
        <span class="tips">
          <span style="color:red;">*</span> 3-20位,英文或数字
        </span>
      </p>
    <%end%>
    <p><label for="user_email">Email</label>
      <%= f.text_field :email,:title=>"请输入正确格式的电子邮件.",:size=>20 %>
      <span class="tips">
        <span style="color:red;">*</span> 常用的邮箱
      </span>
    </p>
    <% unless @user.id %>
      <p><label for="user_password">密码</label>
        <%= f.password_field :password,:title=>"密码格式不正确",:size=>15 %>
        <span class="tips">
          <span style="color:red;">*</span> 5-20位
        </span>
      </p>

      <p><label for="user_password_confirmation">密码确认</label>
        <%= f.password_field :password_confirmation,:title=>"密码不一致",:size=>15 %>
        <span class="tips">
          <span style="color:red;">*</span> 重复密码
        </span>
      </p>
    <%  end %>
    <p><label for="user_nickname">昵称</label>
      <%= f.text_field :nickname,:title=>"3-20位,中文或英文字母组合.",:size=>15 %>
      <span class="tips">
        3-20位,中文或英文
      </span>
    </p>

    <p>
      <label for="user_sex">性别</label>
      <%=select("user", "sex",User::SEX,:prompt => "请选择..")%>
    </p>

    <% unless @user.id %>
      <p id="code">
        <label>验证码</label>
        <%= show_simple_captcha(:label => "<span style='color:red;'>*</span> 输入验证码",
          :code_type=>"numeric") %>
      </p>

      <div style="text-align:center;margin-top: 15px;">
        <a href="/articles/3/#fwtk" target="_blank">点击阅读TT小站服务条款</a>
        <br />
        <%= image_submit_tag('/images/register.gif',:style=>"border:none;margin-top: 5px;")%>
      </div>
    <%else%>
      <div style="margin:20px 125px;">
        <%= image_submit_tag('/images/save_button.gif',:style=>"border:none;")%>
        <a href="/store/mine" style="text-decoration:none"> 
          <img alt="cancel" src="/images/cancel.gif" title="取消" />
        </a>
      </div>
    <%end%>
  <% end -%>

</div>